﻿<UserControl x:Class="SPIWareMVVM.Views.MaterialList"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:conv="clr-namespace:SPIWareMVVM.Views.Conversions"
             xmlns:me="clr-namespace:SPIWareMVVM.ViewModels" 
             xmlns:views="clr-namespace:SPIWareMVVM.Views"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <ObjectDataProvider x:Key="materialsVM" ObjectType="{x:Type me:MaterialsViewModel}"/>
        <ObjectDataProvider x:Key="applicationData" ObjectType="{x:Type me:ApplicationData}"/>
        <conv:BoolToVisibilityConverter x:Key="boolToVis" />
    </UserControl.Resources>
    <DockPanel>
        <ToolBar DockPanel.Dock="Top">
            <TextBlock DockPanel.Dock="Top" Text="Parts" Background="Azure" Width="75"/>
            <Separator/>
        </ToolBar>
        <ListBox DockPanel.Dock="Left" x:Name="lbMaterials" ItemsSource="{Binding Path=ocMachinePresses, Source={StaticResource applicationData}, Mode=TwoWay}"
                 SelectionChanged="Materials_SelectionChanged"/>
        <DockPanel x:Name="dpMaterialsEdit" DockPanel.Dock="Top" Visibility="Collapsed">
            <StackPanel DockPanel.Dock="Top" Orientation="Horizontal">
                <TextBlock Text="("/>
                <TextBlock Text="{Binding Path=SelectedItem.PartsId, ElementName=lbMaterials}"/>
                <TextBlock Text=") "/>
                <TextBlock Text="{Binding Path=SelectedItem.Description, ElementName=lbMaterials}"/>
            </StackPanel>
            <ToolBar DockPanel.Dock="Left" Background="MidnightBlue"/>
            <StackPanel x:Name="spPartInformation" DockPanel.Dock="Bottom" Orientation="Vertical">
                <views:MaterialEdit x:Name="editMaterial" IsEnabled="True"/>
            </StackPanel>
        </DockPanel>
    </DockPanel>
</UserControl>
